poincare_map Interface

public interface poincare_map

Contents


Module Procedures

private pure function poincare_map_samples(x, y, z, pln, side) result(rst)

Generates a Poincare map by determining the intersections of the supplied trajectory with the specified plane. For consecutive samples and , the segment is interpolated as and the section point satisfies . A crossing at an exactly sampled point is returned once, provided the nearest non-section samples on either side lie on opposite sides of the plane. Tangencies and runs of samples on the plane are not crossings and are ignored. A final sample on the plane is returned once if the preceding segment approaches it.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:) :: x

The x-coordinates of the trajectory.

real(kind=real64), intent(in), dimension(size(x)) :: y

The y-coordinates of the trajectory.

real(kind=real64), intent(in), dimension(size(x)) :: z

The z-coordinates of the trajectory.

class(plane), intent(in), optional :: pln

The plane to intersect. If not supplied, the x-y plane is utilized where z = 0.

integer(kind=int32), intent(in), optional :: side

An integer flag denoting which approach to use when computing the section. The acceptable values are as follows.

  • POINCARE_TWO_SIDED (Default): A two-sided Poincare section will be computed. In this section, the algorithm does not care whether the trajectory approaches the sectioning plane from the front or the back of the plane (defined by the plane normal).
    It simply returns any intersection point.

  • POINCARE_ONE_SIDED_FROM_FRONT: A one-sided Poincare section will be computed where the algorithm only retains intersection points where the trajectory approaches the sectioning plane from the front (the side of the plane normal).

  • POINCARE_ONE_SIDED_FROM_BACK: A one-sided Poincare section will be computed where the algorithm only retains intersection points where the trajectory approaches the sectioning plane from the back (the side opposite the plane normal).

Return Value real(kind=real64), allocatable, dimension(:,:)

An N-by-3 matrix containing the x, y, and z coordinates of each of the N intersection points in the first, second, and third columns respectively.

private function poincare_map_ode(sys, tspan, iv, sample_count, pln, side, solver, chunk_size, coordinates, args, progress_callback) result(rst)

Computes a Poincare section from uniformly spaced ODE samples while retaining only one solution chunk and the resulting section points. Each chunk starts from the preceding chunk's final solution state. As with poincare_map_samples, a final sample on the plane can be retained if the preceding segment approaches it.

Arguments

Type IntentOptional Attributes Name
class(ode_container), intent(inout) :: sys

The ODE system to integrate. Its equation function must be set.

real(kind=real64), intent(in), dimension(2) :: tspan

The increasing start and end times of the complete solve.

real(kind=real64), intent(in), dimension(:) :: iv

The initial value of each ODE state at tspan(1). At least one state is required, or three when coordinates is not supplied.

integer(kind=int32), intent(in) :: sample_count

The number of uniformly spaced samples across tspan, including both endpoints. Must be at least two.

class(plane), intent(in), optional :: pln

The section plane. Defaults to the x-y plane (z = 0).

integer(kind=int32), intent(in), optional :: side

The crossing direction: POINCARE_TWO_SIDED (default), POINCARE_ONE_SIDED_FROM_FRONT, or POINCARE_ONE_SIDED_FROM_BACK.

class(ode_integrator), intent(inout), optional, target :: solver

The ODE solver to use. Defaults to runge_kutta_45. Its solution buffer is cleared for each chunk and on return; other solver settings, including tolerances, are retained.

integer(kind=int32), intent(in), optional :: chunk_size

Maximum number of sample intervals per solve. Must be positive; defaults to 1000. The solve requests at most chunk_size + 1 samples, except that a one-interval solve requests a midpoint.

procedure(poincare_coordinates), optional :: coordinates

Maps each sampled time and ODE state to section coordinates. Defaults to the first three state components.

class(*), intent(inout), optional :: args

Optional user data forwarded to each ODE solver call.

procedure(poincare_map_progress), intent(in), optional, pointer :: progress_callback

Optional notification after each completed sample chunk.

Return Value real(kind=real64), allocatable, dimension(:,:)

An N-by-3 array of section intersections in x, y, z order.